<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta name="twitter:site" content="@metroui">
    <meta name="twitter:creator" content="@pimenov_sergey">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="Metro 4 Components Library">
    <meta name="twitter:description" content="Metro 4 is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with responsive grid system, extensive prebuilt components, and powerful plugins  .">
    <meta name="twitter:image" content="https://metroui.org.ua/images/m4-logo-social.png">

    <meta property="og:url" content="https://metroui.org.ua/v4/index.html">
    <meta property="og:title" content="Metro 4 Components Library">
    <meta property="og:description" content="Metro 4 is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with responsive grid system, extensive prebuilt components, and powerful plugins  .">
    <meta property="og:type" content="website">
    <meta property="og:image" content="https://metroui.org.ua/images/m4-logo-social.png">
    <meta property="og:image:secure_url" content="https://metroui.org.ua/images/m4-logo-social.png">
    <meta property="og:image:type" content="image/png">
    <meta property="og:image:width" content="968">
    <meta property="og:image:height" content="504">

    <meta name="author" content="Sergey Pimenov">
    <meta name="description" content="The most popular HTML, CSS, and JS library in Metro style.">
    <meta name="keywords" content="HTML, CSS, JS, Metro, CSS3, Javascript, HTML5, UI, Library, Web, Development, Framework">

    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="icon" href="favicon.ico" type="image/x-icon">

    <link href="metro/css/metro-all.css?ver=@@b-version" rel="stylesheet">
    <link href="highlight/styles/github.css" rel="stylesheet">
    <link href="docsearch/docsearch.min.css" rel="stylesheet">
    <link href="css/site.css" rel="stylesheet">

    <title>Image compare - Metro 4 :: Popular HTML, CSS and JS library</title>
</head>
<body class="m4-cloak">

<header data-role="html-container" data-insert-mode="replace" data-html-source="header.html"></header>

<div data-role="html-container" data-insert-mode="replace" data-html-source="sidebar-menu.html"></div>

<div class="container-fluid docs-content">

    <div class="row flex-xl-nowrap">

            <div class="d-none d-block-xl cell-xl-2 order-2 border-left bd-light toc-wrapper">
                <h5>Table of contents</h5>
                <hr/>
                <ul class="toc-nav">
                    <li class="toc-entry"><a href="#">Image compare</a></li>
                    <li class="toc-entry"><a href="#_ic_about">About</a></li>
                    <li class="toc-entry"><a href="#_ic_size">Set size</a></li>
                    <li class="toc-entry"><a href="#_ic_events">Events</a></li>
                </ul>

            </div>

            <main class="cell-xl-10 order-1 pr-1-sx pl-1-sx pr-5-md pl-5-md">
                <div class="place-right d-none d-block-lg" style="width: 200px;">
                    <img src="images/logo.png" class="w-100" alt="">
                </div>

                <h1>Image compare</h1>
                <p class="text-leader">
                    Create interactive image compare with Metro 4 component.
                </p>

                <!-- ads-html -->

                <h3 id="_ic_about">About</h3>
                <p>
                    To create <code>image-compare</code>, add attribute <code>data-role="imagecompare"</code> to your container and put into container two images.
                </p>
                <div class="example d-flex flex-justify-center">
                    <div class="image-compare" data-role="imagecompare">
                        <img src="images/ic-1.jpg">
                        <img src="images/ic-2.jpg">
                    </div>
                </div>
                <pre><code>
                    &lt;div class="image-compare" data-role="imagecompare"&gt;
                        &lt;img src="images/ic-1.jpg"&gt;
                        &lt;img src="images/ic-2.jpg"&gt;
                    &lt;/div&gt;
                </code></pre>

                <h3 id="_ic_size">Set size</h3>
                <p>
                    You can change size of <code>image-compare</code> with attributes <code>data-width</code> and <code>data-height</code>.
                    By default, these attributes have next values: <code>data-width="100%"</code>, <code>data-height="auto"</code>.
                    You can use <code>integer</code>, <code>percent</code> or <code>aspect-ratio</code> values.
                </p>

                <h4>Aspect-ratio value</h4>
                <p>
                    To set component height, you can use special <code>aspect-ratio</code> values:
                    <code>16/9</code>,
                    <code>21/9</code>,
                    <code>4/3</code>.
                </p>

                <h4>Fixed size</h4>
                <p>
                    To set fixed size, use integer values for attributes <code>data-width</code> and <code>data-height</code>.
                </p>
                <div class="example d-flex flex-justify-center">
                    <div class="image-compare" data-role="imagecompare" data-width="300" data-height="200">
                        <img src="images/ic-1.jpg">
                        <img src="images/ic-2.jpg">
                    </div>
                </div>
                <pre><code>
                    &lt;div class="image-compare" data-role="imagecompare" data-width="300" data-height="200"&gt;
                        &lt;img src="images/ic-1.jpg"&gt;
                        &lt;img src="images/ic-2.jpg"&gt;
                    &lt;/div&gt;
                </code></pre>

                <!-- ads-html -->

                <h4>Responsive container</h4>
                <p>
                    If you need a response <code>image-compare</code>, set <code>data-width="100%"</code> and use special values for <code>data-height</code> attribute:
                        <code>16/9</code>,
                        <code>21/9</code>,
                        <code>4/3</code>,
                        <code>auto</code> (for auto used <code>16/9</code> value).
                </p>
                <div class="example d-flex flex-justify-center">
                    <div class="image-compare" data-role="imagecompare" data-height="16/9">
                        <img src="images/ic-1.jpg">
                        <img src="images/ic-2.jpg">
                    </div>
                </div>
                <pre><code>
                    &lt;div class="image-compare" data-role="imagecompare" data-height="16/9"&gt;
                        &lt;img src="images/ic-1.jpg"&gt;
                        &lt;img src="images/ic-2.jpg"&gt;
                    &lt;/div&gt;
                </code></pre>

                <h3 id="_ic_events">Events</h3>
                <p>
                    You can create callback for component events:
                    <code>data-on-resize</code>, <code>data-on-slider-move</code> and <code>data-on-image-compare-create</code>.
                </p>

            </main>
        </div>

    </div>

    <script src="docsearch/docsearch.min.js"></script>


    <script src="metro/js/metro.js?ver=@@b-version"></script>
    <script src="highlight/highlight.pack.js"></script>
    <script src="js/clipboard.min.js"></script>
    <script src="js/site.js"></script>
    <!-- ads-script -->
    <!-- ga-script -->
    <!-- hit-ua -->
</body>
</html>